<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotModelactiviteanalyse extends Application_Model_ModelAbstract
{

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTMODELACTIVITEANALYSE;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTMODELANALYSE;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTMODELACTIVITE;


    /**
     * Parent relation fk_PILOT_MODELACTIVITEANALYSE_PILOT_MODELANALYSE1
     *
     * @var Application_Model_PilotModelanalyse
     */
    protected $_PilotModelanalyse;

    /**
     * Parent relation fk_PILOT_MODELACTIVITEANALYSE_PILOT_MODELACTIVITE1
     *
     * @var Application_Model_PilotModelactivite
     */
    protected $_PilotModelactivite;


    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_MODELACTIVITEANALYSE'=>'IdPILOTMODELACTIVITEANALYSE',
            'idPILOT_MODELANALYSE'=>'IdPILOTMODELANALYSE',
            'idPILOT_MODELACTIVITE'=>'IdPILOTMODELACTIVITE',
        ));

        $this->setParentList(array(
            'FkPILOTMODELACTIVITEANALYSEPILOTMODELANALYSE1'=> array(
                    'property' => 'PilotModelanalyse',
                    'table_name' => 'PilotModelanalyse',
                ),
            'FkPILOTMODELACTIVITEANALYSEPILOTMODELACTIVITE1'=> array(
                    'property' => 'PilotModelactivite',
                    'table_name' => 'PilotModelactivite',
                ),
        ));

        $this->setDependentList(array(
        ));
    }

    /**
     * Sets column idPILOT_MODELACTIVITEANALYSE
     *
     * @param string $data
     * @return Application_Model_PilotModelactiviteanalyse
     */
    public function setIdPILOTMODELACTIVITEANALYSE($data)
    {
        $this->_IdPILOTMODELACTIVITEANALYSE = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_MODELACTIVITEANALYSE
     *
     * @return string
     */
    public function getIdPILOTMODELACTIVITEANALYSE()
    {
        return $this->_IdPILOTMODELACTIVITEANALYSE;
    }

    /**
     * Sets column idPILOT_MODELANALYSE
     *
     * @param string $data
     * @return Application_Model_PilotModelactiviteanalyse
     */
    public function setIdPILOTMODELANALYSE($data)
    {
        $this->_IdPILOTMODELANALYSE = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_MODELANALYSE
     *
     * @return string
     */
    public function getIdPILOTMODELANALYSE()
    {
        return $this->_IdPILOTMODELANALYSE;
    }

    /**
     * Sets column idPILOT_MODELACTIVITE
     *
     * @param string $data
     * @return Application_Model_PilotModelactiviteanalyse
     */
    public function setIdPILOTMODELACTIVITE($data)
    {
        $this->_IdPILOTMODELACTIVITE = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_MODELACTIVITE
     *
     * @return string
     */
    public function getIdPILOTMODELACTIVITE()
    {
        return $this->_IdPILOTMODELACTIVITE;
    }

    /**
     * Sets parent relation IdPILOTMODELANALYSE
     *
     * @param Application_Model_PilotModelanalyse $data
     * @return Application_Model_PilotModelactiviteanalyse
     */
    public function setPilotModelanalyse(Application_Model_PilotModelanalyse $data)
    {
        $this->_PilotModelanalyse = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_MODELANALYSE'];
        }

        $this->setIdPILOTMODELANALYSE($primary_key);

        return $this;
    }

    /**
     * Gets parent IdPILOTMODELANALYSE
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotModelanalyse
     */
    public function getPilotModelanalyse($load = true)
    {
        if ($this->_PilotModelanalyse === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTMODELACTIVITEANALYSEPILOTMODELANALYSE1', $this);
        }

        return $this->_PilotModelanalyse;
    }

    /**
     * Sets parent relation IdPILOTMODELACTIVITE
     *
     * @param Application_Model_PilotModelactivite $data
     * @return Application_Model_PilotModelactiviteanalyse
     */
    public function setPilotModelactivite(Application_Model_PilotModelactivite $data)
    {
        $this->_PilotModelactivite = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_MODELACTIVITE'];
        }

        $this->setIdPILOTMODELACTIVITE($primary_key);

        return $this;
    }

    /**
     * Gets parent IdPILOTMODELACTIVITE
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotModelactivite
     */
    public function getPilotModelactivite($load = true)
    {
        if ($this->_PilotModelactivite === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTMODELACTIVITEANALYSEPILOTMODELACTIVITE1', $this);
        }

        return $this->_PilotModelactivite;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotModelactiviteanalyse
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotModelactiviteanalyse());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotModelactiviteanalyse::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTMODELACTIVITEANALYSE() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_MODELACTIVITEANALYSE = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTMODELACTIVITEANALYSE()));
    }
}
